<?php

namespace app\payment\validate;

use think\Validate;

/**
 * 商户号配置验证器
 */
class Mconfig extends Validate
{

    //定义验证规则
    protected $rule = [
        'id|商户号' => 'require',
        'key|充值密钥' => 'require|alphaNum|length:32',
        'withdrawal_key|提现密钥' => 'require|alphaNum|length:32',
        'paid_key|代付密钥' => 'require|alphaNum|length:32',
        'payment_type|支付类型' => 'require',
        'trade_type|交易类型' => 'require',
        'min_recharge_cash|最小充值金额' => '',
        'max_recharge_cash|最大充值金额' => '',
        'day_recharge_cash_sum|商户每天最多充值金额总数' => 'require',
        'day_recharge_type_cash_sum|每天支付类型最多充值金额总数' => '',
        'min_paid_cash|最小提现金额' => 'require|float|egt:0.01',
        'max_paid_cash|最大提现金额' => 'require|float|egt:0.01',
        'day_paid_cash_sum|商户每天最多代付金额总数' => 'require|float|egt:0.01',
        'paid_start_price|银行卡每次代付开始价格' => 'require|float|egt:0',
        'paid_rate|银行卡代付费率' => 'require|float|between:0,1',
        'alipay_paid_start_price|支付宝每次代付开始价格' => 'require|float|egt:0',
        'alipay_paid_rate|支付宝代付费率' => 'require|float|between:0,1',
        'payment_type_rate|支付类型费率' => '',
        'sup_merchant|上级代理商户号' => 'number|length:8',
        'trade_pwd|交易密码' => 'length:6,16',
        'mobile|商户手机号' => 'number|length:11',
        'email|商户邮箱' => 'email',
    ];
    //定义验证提示
    protected $message = [];
    //定义验证场景
    protected $scene = [
        //更新
        'update' => ['id' => 'require', 'key' => '', 'payment_type' => ''],
    ];

    // 验证场景定义
    public function sceneInfo()
    {
        return  $this->only(['email', 'mobile']);
    }
}
